<template>
  <div class="Find">
    <div class="FindVideo">
      <div class="FindVideo-title">
        <van-row>
          <van-col span="14" class="FindVideo-title-left">
            <img
              @click="handleClick"
              class="FindVideo-title-img1"
              src="../assets/images/视频页面/1.png"
              alt=""
            />

            <span class="FindVideo-title-span1">知识</span>
            <div class="FindVideo-title-span2">
              <p class="FindVideo-title-span21">科普常识</p>
              <p class="FindVideo-title-span22">昨天00:00</p>
            </div>
            <a href="">
              <img
                class="FindVideo-title-img2"
                src="../assets/images/视频页面/2.png"
                alt=""
              />
            </a>
          </van-col>

          <van-col span="10" class="FindVideo-title-right">
            <van-button
              round
              type="primary"
              color="#F4D547"
              size="small"
              class="FindVideo-title-button"
            >
              <span>+</span> 关注</van-button
            >
            <img
              class="FindVideo-title-img3"
              src="../assets/images/视频页面/3.png"
              alt=""
            />
          </van-col>
        </van-row>
      </div>
      <div class="FindVideo-title-types">
        你每天的“状态”，原来是体内这两种激素在操控
      </div>
      <div class="FindVideo-title-video" style="background: black">
        <div class="mask" v-if="state.maskflag"></div>
        <div style="text-align: center" class="center-button-zanting">
          <div class="zanting" @click="showZanting">
            <button>
              <img
                class="FindVideo-title-video-img"
                v-if="state.zhantiflag"
                src="../assets/images/视频页面/17.png"
                alt=""
                @click="playPause()"
              />
              <img
                class="FindVideo-title-video-img"
                src="../assets/images/视频页面/15.png"
                alt=""
                v-if="state.videoflag"
                @click="bofang"
              />
            </button>
          </div>
          <br />
          <video
            id="video1"
            width="375"
            height="185"
            :controls="istrue"
            loop="loop"
            ref="vid"
            :autoplay="state.play"
          >
            <source
              src="http://120.53.242.139:3000/media/video1.84947a1a.mp4"
              type="video/mp4"
            />
            您的浏览器不支持 HTML5 video 标签。
          </video>
        </div>
      </div>
      <div class="FindVideo-title-content">
        <div class="FindVideo-title-content1">书记解读</div>
        <div class="FindVideo-title-content2">
          <img
            class="FindVideo-title-content2-img"
            src="../assets/images/视频页面/7.png"
            alt=""
          />
          <div class="FindVideo-title-content2-right">
            <p class="FindVideo-title-content2-right-part1">高能量姿势</p>
            <p class="FindVideo-title-content2-right-part2">
              两分钟的自信高能量暴增法
            </p>
            <p class="FindVideo-title-content2-right-part3">播放量1718.4万</p>
          </div>
        </div>
      </div>
      <div class="FindVideo-title-solid"></div>
      <div class="FindVideo-title-types2">
        当我们在谈论自己的状态时,我们到底在谈论什么?
      </div>
      <div class="FindVideo-title-types3">
        “状态”的好与坏,在生理学上来说,主要取决于两种激素:睾酮和皮质醇。当睾酮水平高而皮质醇水平低时,我们就会感到活力慢慢,反之就会觉得精神萎靡。
      </div>
      <div class="FindVideo-title-solid2"></div>
    </div>
    <div class="FindVideo-footer">
      <van-row class="FindVideo-footer-content">
        <van-col span="8" class="FindVideo-footer-a">
          <div @click="onclick1">
            <img class="icon" :src="state.src1" alt="" />{{ state.count1 }}
          </div>
        </van-col>
        <van-col span="8" class="FindVideo-footer-a">
          <div @click="onclick2">
            <img class="icon" :src="state.src2" alt="" />{{ state.count2 }}
          </div>
        </van-col>
        <van-col span="8" class="FindVideo-footer-a">
          <div @click="onclick3" v-bind="state.flag">
            <img class="icon" :src="state.src3" alt="" />{{ state.count3 }}
          </div>
        </van-col>
      </van-row>
    </div>
  </div>
</template>

<script type="text/javascript">
import { ref, reactive } from "vue";
import { useRouter } from "vue-router";

export default {
  setup() {
    const vid = ref(null);

    const state = reactive({
      count1: 1,
      count2: 10,
      count3: 8,
      src1: require("@/assets/images/视频页面/8.png"),
      src2: require("@/assets/images/视频页面/9.png"),
      src3: require("@/assets/images/视频页面/10.png"),
      flag: true,
      videoflag: false,
      play: "autoplay",
      zhantiflag: false,
      maskflag: false,
    });
    const router = useRouter();
    const onclick1 = () => {
      router.push("/comment");
      return state.count1;
    };

    const handleClick = () => {
      router.go(-1);
    };
    const onclick2 = () => {
      if (state.flag) {
        state.src2 = require("@/assets/images/视频页面/5.png");
        state.count2++;
        state.flag = false;
      } else {
        state.src2 = require("@/assets/images/视频页面/9.png");
        state.count2--;
        state.flag = true;
      }
    };
    const onclick3 = () => {
      if (state.flag) {
        state.src3 = require("@/assets/images/视频页面/6.png");
        state.count3++;
        state.flag = false;
      } else {
        state.src3 = require("@/assets/images/视频页面/10.png");
        state.count3--;
        state.flag = true;
      }
    };
    const istrue = ref(true);
    // const PauseContent=()=>{
    //   istrue.value = false;
    //    console.log(22222);
    //  }
    const playPause = () => {
      state.videoflag = true;
      state.zhantiflag = true;
      if (vid.value.paused) {
        vid.value.play();
      } else {
        vid.value.pause();
      }
    };
    const bofang = () => {
      state.videoflag = false;
      state.zhantiflag = true;
      state.maskflag = true;

      vid.value.play();
    };
    const showZanting = () => {
      state.zhantiflag = !state.zhantiflag;
      state.maskflag = !state.maskflag;
    };
    const video1onclick = () => {
      console.log(1);

      console.log(vid);
      if (state.videoflag) {
        if (vid.value.paused) {
          vid.value.play();
          state.videoflag = false;
        }
      }
    };

    return {
      state,
      onclick1,
      onclick2,
      onclick3,
      handleClick,
      video1onclick,
      bofang,
      vid,
      // PauseContent,
      istrue,
      showZanting,
      playPause,
    };
  },
};
</script>

<style lang="less">
.Find {
  .FindVideo {
    margin-bottom: 50px;
  }
  .FindVideo-title {
    padding-top: 10px;
  }
  .FindVideo-title-img {
    width: 13px;
    height: 22px;

    margin-right: 17px;
  }
  .FindVideo-title-span1 {
    width: 24px;

    font-size: 12px;
    font-family: PingFangSC;
    font-weight: 600;
    color: #000000;
    margin-right: 8px;
  }
  .FindVideo-title-span2 {
    display: inline-block;
  }
  .FindVideo-title-span21 {
    /* width: 57px; */
    width: 100%;
    text-align-last: justify;
    justify-content: space-between;
    height: 12px;
    font-size: 12px;
    font-family: PingFangSC;
    font-weight: 600;
    color: #000000;
  }
  .FindVideo-title-span22 {
    /* height: 8px; */
    font-size: 10px;
    font-family: PingFangSC;
    font-weight: 600;
    color: #9d9d9d;
  }
  .FindVideo-title-img1 {
    width: 11px;
    height: 14px;
    margin-right: 14px;
  }
  .FindVideo-title-img2 {
    width: 11px;
    height: 11px;
    margin-bottom: 20px;
    margin-bottom: 10px;
    margin-left: 5px;
  }
  .FindVideo-title-left {
    display: flex;
    align-items: center;

    padding-left: 15px;
  }
  .FindVideo-title-button {
    width: 56px;
    height: 24px;
  }
  .FindVideo-title-img3 {
    width: 20px;
    height: 18px;
    margin-left: 8px;
    margin-right: 13px;
  }
  .FindVideo-title-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  .FindVideo-title-types {
    width: 320px;

    font-size: 17px;
    font-family: PingFangSC;
    font-weight: 600;
    color: #1b0b00;
    margin-left: 15px;
    margin-top: 13px;
    margin-bottom: 18px;
  }
  /* 视屏 */
  .FindVideo-title-video {
    margin-top: 16px;
    margin-bottom: 10px;
    position: relative;
  }
  .FindVideo-title-video-img {
    position: absolute;
    z-index: 99;
    width: 50px;
    top: 29%;
    left: 45%;
  }
  .FindVideo-title-content {
    padding-left: 19px;
    margin-right: 20px;
  }
  .FindVideo-title-content1 {
    margin-left: 11px;
    background: #f6d046;
    width: 60px;
    /* height: 24px; */
    background: #f6d046;
    border-radius: 5px 5px 0 0;
    font-size: 9px;
    font-family: PingFangSC;
    font-weight: 600;
    color: #1b0b00;
    text-align-last: justify;
  }
  .FindVideo-title-content2-img {
    width: 57px;
    height: 75px;
    margin-right: 9px;
    margin-left: 10px;
  }
  .FindVideo-title-content2 {
    margin-left: 10px;
    padding-top: 11px;
    padding-bottom: 5px;
    background: #f5f6f8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    margin-bottom: 22px;
  }
  .FindVideo-title-content2-right {
    display: inline-block;
  }
  .FindVideo-title-content2-right-part1 {
    width: 62px;
    text-align-last: justify;
    font-size: 12px;
    font-family: PingFangSC;
    font-weight: 600;
    color: #1b0b00;
  }
  .FindVideo-title-content2-right-part2 {
    font-size: 12px;
    font-family: PingFangSC;
    font-weight: 600;
    color: #4c4c4c;
  }
  .FindVideo-title-content2-right-part3 {
    font-size: 12px;
    font-family: PingFangSC;
    font-weight: 600;
    color: #bfa35c;
  }
  .FindVideo-title-content2-right-part2 {
    margin-top: 7px;
    margin-bottom: 7px;
  }
  .FindVideo-title-solid {
    height: 6px;
    background: #f5f6f8;
  }

  .FindVideo-title-solid2 {
    margin-left: 15px;
    background: #f5f6f8;
    height: 1px;
  }
  .FindVideo-title-types2 {
    width: 350px;

    font-size: 17px;
    font-family: PingFangSC;
    font-weight: 400;
    color: #000000;
    margin-left: 15px;
    margin-top: 37px;
    margin-bottom: 35px;
    text-align-last: initial;
  }
  .FindVideo-title-types3 {
    width: 350px;
    font-size: 17px;
    font-family: PingFangSC;
    font-weight: 400;
    color: #000000;
    margin-left: 15px;
    margin-bottom: 40px;
    text-align-last: initial;
  }
  .FindVideo-footer {
    overflow: hidden;
  }
  .FindVideo-footer .van-row {
    height: 50px;
    width: 100%;
    position: fixed;
    bottom: 0px;
    left: 0px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    .van-col {
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
  .van-col {
    width: 70px;
  }
  .icon {
    width: 18px;
    height: 15px;
    margin-right: 2px;
  }
  .FindVideo-footer-a a {
    color: black;
    text-decoration: none;
    font-size: 12px;
    font-family: PingFangSC;
    font-weight: 400;
    color: #494949;
  }
  .FindVideo-footer-a div {
    color: black;
    text-decoration: none;
    font-size: 12px;
    font-family: PingFangSC;
    font-weight: 400;
    color: #494949;
  }
  .FindVideo-footer-content {
    margin-top: 40px;
  }
  .center-button-zanting {
    position: relative;
  }
  .zanting {
    width: 375px;
    height: 185px;
    position: absolute;
    z-index: 50;
    left: 0;
    top: 0;
    outline: none;
    border: none;
    background: transparent;
    color: transparent;
  }
  .center-button-zanting {
    display: flex;
    align-items: center;
  }
  .mask {
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    background: #868c89;
    z-index: 1;
    opacity: 0.5;
  }
}
</style>
